{include file="public/header280" /}
<div class="layui-form" style="padding: 10px 0 0 0;">
  <div class="layui-form-item">
    <label class="layui-form-label">角色</label>
    <div class="layui-input-inline">
      <input type="text" name="name" lay-verify="required" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">权限范围</label>
    <div class="layui-input-block">
      <div id="test-tree-demo1"></div>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">角色描述</label>
    <div class="layui-input-block">
      <input type="text" name="desc" lay-verify="required" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item layui-hide">
    <button class="layui-btn" lay-submit lay-filter="LAY-user-role-submit" id="LAY-user-role-submit">提交</button>
  </div>
</div>
<script>
layui.use(['tree', 'util'], function(){
  var $ = layui.$
          ,tree = layui.tree
          ,layer = layui.layer
          ,util = layui.util;

  var data = [];
  $.ajax({
    url: "{:url('systemMenu/getSystemMenu')}",
    type: "post",
    dataType: 'json',
    async: false,
    success: function (res) {
      data = res.data;
    },
  });
  tree.render({
    elem: '#test-tree-demo1'
    , data: data
    , id: 'demoId1'
    , showCheckbox: true
    , isJump: true
    , click: function(obj){
      var data = obj.data;  //获取当前点击的节点数据
      layer.msg('状态：'+ obj.state + '<br>节点数据：' + JSON.stringify(data));
    }
  });
})
</script>
{include file="public/footer" /}